import { useRouter } from "vue-router";
import { Article } from "@/types/article";
/**
 * 跳转文章详情
 * @returns
 */
export const useNavArticle = (): {
  goToArticleInfo: (article: Article) => void;
} => {
  const router = useRouter();
  const goToArticleInfo = (article: Article) => {
    if (article.id) {
      router.push({ path: "article", query: { id: article.id } });
    }
  };
  return {
    goToArticleInfo,
  };
};
